﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="locationmonitor.aspx.cs" Inherits="qy_54tss_Admin_GpsSet_locationmonitor"
    EnableEventValidation="false" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>查看商家配送员位置-<%= WebUtility.GetMyName() %></title>
    <link href="css/indis_style.css" rel="stylesheet" type="text/css" />
    <link href="../css/building.css" rel="stylesheet" type="text/css" />
    <link href="../css/divDialog.css" rel="stylesheet" type="text/css" />
    <link href="../../javascript/jbox/Skins/jbox.css" rel="stylesheet" />

    <script src="../javascript/eventwrapper.min.js" type="text/javascript"></script>

    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>

    <script src="../javascript/jquery-1.3.2.js" type="text/javascript"></script>
    <script src="../javascript/Common.js?v=1515" type="text/javascript"></script>

    <script src="javascript/orderdeliver.js?v=1103" type="text/javascript"></script>
    <script src="../../javascript/jCommon.js" type="text/javascript"></script>
    <script src="../../javascript/jquery.floatDiv.js" type="text/javascript"></script>
    <script src="javascript/locationmonitor.js"></script>



    <script type="text/javascript">
        var NearbyDelivery = [];
        $(document).ready(function () {
            var id = $("#hfflag").val();
            if (id == "1") {
                show_citytable();
            }
        })

    </script>

    <style type="text/css">
        .system_shop {
            border: solid red 1px;
        }
    </style>

</head>
<body>
    <form id="form1" runat="server">
        <asp:HiddenField runat="server" ID="hidLat" />
        <asp:HiddenField runat="server" ID="hidLng" />
        <asp:HiddenField runat="server" ID="hfcityname" />
        <asp:HiddenField runat="server" ID="hfcityid" />
        <asp:HiddenField runat="server" ID="hfflag" Value="0" />
        <asp:HiddenField runat="server" ID="hf_curr_dids" />
        <asp:HiddenField runat="server" ID="hforderuserlatlng" />

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div class="wrap">
            <div class="indis_top">
                <a href="../../index.aspx" class="float_l padding_l5">
                    <img src="../../images/logo.png" style="height: 75px;" /></a><span
                        class="top_title">查看商家配送员位置</span><span class="fa margin_t3">操作员：<label runat="server"
                            id="lbadminname"></label></span>

                <p>
                    <label runat="server" id="snDate">
                    </label>
                </p>
                <p>
                    <a href="../basic.aspx">返回后台</a>
                </p>
            </div>
            <div class="indis_con">
                <div class="indis_left" style=" width:9%;  height:538px;" >
                    <h4 style="line-height: 30px; padding-left:20px;">筛选</h4>
                    <div style="font-size:14px; padding-left:20px;">
                        <input type="checkbox" value="0" id="cbshop" onclick="showallshop()" /><label for="cbshop">商家</label>

                        <input type="checkbox" value="1" id="cbdeliver" onclick="showalldeliver()" /><label for="cbdeliver">骑士</label>

                        <div style="display:none" id="divDeliver"></div>
                    </div>
                 

                </div>
                <div class="indis_right" style=" width:90.6%;">
                    <div class="indis_right_top" >
                        <div class="indis_right_map" style="width:99%;">
                            <div id="map_canvas" style="width: 100%; height: 538px">
                            </div>
                        </div>
                      
                    </div>
                </div>
                <div class="clear">
                </div>
               
            </div>
        </div>


        <script type="text/javascript">
            function loading() {
                
            }

            function loadover() {
               
            }


            function LoadDeliver(type) {
                var hfcityid = $("#hfcityid").val();
                markerlist.length = 0;
                var sname = $("#ddlsection option:selected").text();
                $.ajax({
                    type: "get",
                    url: "../ajax/GetDeliverList.aspx",
                    cache: false,
                    dataType: "html",
                    data: "type=" + type + "&sname=" + escape(sname) + "&cid=" + hfcityid,
                    beforeSend: function (XMLHttpRequest) {
                        loading();
                    },
                    success: function (data, textStatus) {
                        //处理数据
                        $("#divDeliver").html(data);

                        loadover();

                        //显示所有配送员
                        var deliverlist = eval("(" + $("#deliverlistjson").val() + ")");
                        for (var i = 0; i < deliverlist.length; i++) {
                            var d_point = new BMap.Point(deliverlist[i].Lng, deliverlist[i].Lat); // 创建点坐标
                            var d_icon = new BMap.Icon('/Admin/Service/images/mapmarker/marker_' + deliverlist[i].workstate + '.png', new BMap.Size(20, 34), { anchor: new BMap.Size(10, 0) });
                            var d_marker = new BMap.Marker(d_point, { icon: d_icon });
                            var deliverlabel = new BMap.Label(deliverlist[i].Name + "(" + deliverlist[i].OrderNum + ")", { offset: new BMap.Size(-28, -22) });
                            deliverlabel.setStyle({ color: "blue", fontSize: "12px", padding: "2px 5px 2px 5px" });
                            d_marker.setLabel(deliverlabel);
                            d_marker.setTitle(deliverlist[i].DataId);
                            map.addOverlay(d_marker);

                            d_marker.addEventListener("click", function (e) {

                                showDeliverBox(this.getTitle(), this);
                            });

                            markerlist.push(d_marker);
                        }

                    },
                    complete: function (XMLHttpRequest, textStatus) {
                        //$("#loading").html("加载完成");
                    },
                    error: function () {
                        //请求出错处理
                    }

                });

                return false;

            }


        </script>

        <script type="text/javascript">
            var gzoom = 17;
            var marker = null;
            var markerlist = new Array(); //配送员
            var shopmarkerlist = new Array(); //商家
            var map = new BMap.Map("map_canvas"); // 创建地图实例
            map.enableScrollWheelZoom();
            var myGeo = new BMap.Geocoder();
            var _lat = parseFloat($("#hidLat").val());
            var _lng = parseFloat($("#hidLng").val());
            var initpoint = new BMap.Point(_lng, _lat); // 创建点坐标
            //图标
            var myIcon = new BMap.Icon("/Admin/images/marker50.png", new BMap.Size(20, 34), { anchor: new BMap.Size(10, 0) });

            var cityname = $("#hfcityname").val();
            map.centerAndZoom(cityname, gzoom);

            map.addControl(new BMap.NavigationControl());  //缩放工具

            function setLatLng(point) {
                document.getElementById("hidLat").value = point.lat;
                document.getElementById("hidLng").value = point.lng;
                return true;
            }

            function showorder(shopid, orderid) {
                var sheight = window.screen.height - 70;
                var swidth = window.screen.width - 10;

                var winoption = "left=0,top=0,height=" + sheight + ",width=" + swidth + ",toolbar=yes,menubar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes";
                var url = "updateorder.aspx?id=" + shopid + "&oid=" + orderid;
                window.open(url, "newwindow", winoption);
            }


            function j_ShowWindow(msg) {
                var innerHTML = "<div style='background-color: #458BC9;height: 19px;padding: 3px 4px 0 10px;'>";
                innerHTML += "<div style='float:left;font-size:12px;color:#fff'>温馨提醒</div>";
                innerHTML += "<div style='float:right;'>";
                innerHTML += "<a href='javascript:HiddenWindow();'><img src='http://www.faneat.com/Images/window_close.gif' alt='关闭窗口' /> </a>";
                innerHTML += "</div></div>";
                innerHTML += "<div style='text-align:left;font-size:12px;width:95%;overflow:hidden;padding:5px; padding-left:10px;' id='divMassage'>";
                innerHTML += msg;
                innerHTML += "</div></div></div>";

                if (!document.getElementById("divMsg")) {
                    var div = document.createElement('div');
                    div.id = 'divMsg';
                    div.setAttribute('style', 'bottom:0px; right:20px; width:350px; height:200px; position: absolute;z-index: 100; background-color:#FFFFFF;border: 2px solid #447AA9;display:none;');
                    div.setAttribute('innerHTML', innerHTML);
                    div.innerHTML = innerHTML;
                    document.body.appendChild(div);
                    with (document.getElementById("divMsg").style) {
                        bottom = "0px";
                        right = "0px";
                        width = "350px";
                        height = "200px";
                        position = "absolute";
                        background = "#FFFFFF";
                        border = "2px solid #447AA9";
                    }
                }
                else {
                    document.getElementById("divMsg").style.display = "block";
                    document.getElementById("divMsg").setAttribute('innerHTML', innerHTML);
                    document.getElementById("divMsg").innerHTML = innerHTML;
                }
                //setTimeout(HiddenWindow, 3000);
            }
            function HiddenWindow() {
                if (document.getElementById("divMsg")) {
                    document.getElementById("divMsg").style.display = "none";
                }
            }

            function select_mycity(name, id) {
                var url = "locationmonitor.aspx?cid=" + id + "&cname=" + escape(name);
                window.location = url;

            }
        </script>

    </form>
</body>
</html>

<script src="../../javascript/jquery.floatDiv.js" type="text/javascript"></script>

